<!--后付费报表-->
<template>
    <div style="height: 100%;">
        <m-page-list
                ref="pageListRef"
                :option="option"
                :page="page"
                :total="total"
                :table-data="tableData"
                :table-loading="tableLoading"
                :page-loading="pageLoading"
                v-model:value="query"
                @h-btn-click="hBtnClick"
                @col-btn-click="colBtnClick"
                @search-data="searchData"
        >
            <template #import>
                <el-upload
                        ref="uploadRef"
                        class="upload-wrap"
                        action=""
                        accept=".xlsx,.xls"
                        :auto-upload="false"
                        :show-file-list="false"
                        :on-change="handleUploadChange"
                >
                    <el-button type="primary" >导入</el-button>
                </el-upload>
            </template>
        </m-page-list>

    </div>
</template>

<script setup>
  import {ref,reactive} from 'vue'
  import * as XLSX from 'xlsx'
  //组件
  import MPageList from '@/components/PageList'
  import MDialogForm from '@/components/DialogForm/DialogForm'
  //请求
  import {getAfterPayStatistics, addAfterPayment, editAfterPayment,delAfterPayment,batchAddPriorityPassengers,batchDelAfterPayment,publicPriorityPassengers,batchImportAfterPayment,exportAfterPayment} from '@/request/api/basicData'
  import {refOpt} from "../const";
  import { readFile} from "../../utils/xlsx";
  import {getAuthority} from "../../utils/permission";
  import {downFile} from "../../utils/utils";

  import {usePageList} from "../../composables/pageList";

  let opts = {
    auth_id: 'EPriorityPassengers',
    getApi: getAfterPayStatistics,addApi:addAfterPayment,editApi:editAfterPayment,delApi:delAfterPayment,
    idKey: 'row_id',
    // confirmCallback: publicPriorityPassengers,
    // deleteCallback: publicPriorityPassengers
  };

  let {option,page,total,tableLoading,pageLoading,tableData,query,dialogRef,dialogShow,dialogData,dialogOption,isAppend,
    newData,hBtnClick,colBtnClick,searchData,getDataList,dialogConfirm} = usePageList(opts);

  option.hLBtns = [];
  option.hRBtns = []
  option.colBtns = []
  option.conditions = [
    {label: '缴费日期',type: 'daterange',field_id: ['paid_date_begin','paid_date_end'],col: 12},
    {label: '服务时间',type: 'text',field_id: 'service_time',col: 12},
    {label: '车费所属期',type: 'text',field_id: 'fare_period',col: 8},
    {...refOpt.school_name,col: 8,rewriteInput: true},
    {label: '班别',type: 'text',field_id: 'class_',col: 8},
  ];
  option.cols = [
    {prop: 'school_name',label: '站点名称' },
    {prop: 'class_',label: '班别' },
    {prop: 'fare_period',label: '车费所属期' },
    {prop: 'total_count',label: '应缴费乘客数' },
    {prop: 'total_fees',label: '应缴金额' },
    {prop: 'paid_count',label: '已缴费乘客数' },
    {prop: 'unpaid_count', label: '未缴费乘客数',},
    {prop: 'unpaid_fees', label: '未缴金额',},
  ];



</script>

<style scoped lang="less">
    .upload-wrap{
        display: inline-block;
        margin: 0 12px;
        vertical-align: bottom;

    }
</style>
